package com.yuyue.springFramework.note05.annotation;

import com.yuyue.springFramework.note01.entity.ArgsOne;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 创建自动填充类
 */
public class RequireEntity {
    private ArgsOne argsOne;

    //根据参数类型自动从容器获取bean填充
    //required决定是否必须填充成功，默认是
    @Autowired(required = false)
    public void setArgsOne(ArgsOne argsOne){
        this.argsOne = argsOne;
    }

    public ArgsOne getArgsOne() {
        return argsOne;
    }
}

//Autowired 注解源码
//@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD, ElementType.ANNOTATION_TYPE})
//@Retention(RetentionPolicy.RUNTIME)
//@Documented
//public @interface Autowired {
//    boolean required() default true;
//}